package leetcode.code443.StringCompression;

import leetcode.IDebug;
import leetcode.helper.HelpDebug;

/**
 * 43.压缩字符串
 *
 * @author Max
 * @date 2021年8月21日
 * @description https://leetcode-cn.com/problems/string-compression/
 */
public abstract class StringCompression implements IDebug {

	@Override
	public void debug1() {
//		输入：chars = ["a","a","b","b","c","c","c"]
//		输出：返回 6 ，输入数组的前 6 个字符应该是：
//		["a","2","b","2","c","3"]
		String str = "aabbccc";
		char[] input = str.toCharArray();
		int output = 6;
		HelpDebug.printInputs(output, input);
		int result = this.compress(input);
		HelpDebug.printObject(result);
	}

	@Override
	public void debug2() {
		String str = "a";
		char[] input = str.toCharArray();
		int output = 1;
		HelpDebug.printInputs(output, input);
		int result = this.compress(input);
		HelpDebug.printObject(result);
	}

	@Override
	public void debug3() {
		String str = "abbbbbbbbbbbb";
		char[] input = str.toCharArray();
		int output = 4;
		HelpDebug.printInputs(output, input);
		int result = this.compress(input);
		HelpDebug.printObject(result);
	}

	@Override
	public void debug4() {
		String str = "abc";
		char[] input = str.toCharArray();
		int output = 3;
		HelpDebug.printInputs(output, input);
		int result = this.compress(input);
		HelpDebug.printObject(result);
	}

	public void debug5() {
		String str = "aaabbaa";
		char[] input = str.toCharArray();
		int output = 6;
		HelpDebug.printInputs(output, input);
		int result = this.compress(input);
		HelpDebug.printObject(result);
	}

	abstract public int compress(char[] chars);

}
